﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;

namespace LunarSF.SHomeWorkshop.LunarMarkdownEditor
{
    class FindTaskListTimeTagItem : FindLineTreeViewItem
    {
        public FindTaskListTimeTagItem(string fileFullPath, string fileShortName, int lineNumber, int startLineOffset, int keywordLength, string lineText, Brush foreColor, ItemType type, TextDecorationCollection textDecorations = null) : base(fileFullPath, fileShortName, lineNumber, startLineOffset, keywordLength, lineText, foreColor, type, textDecorations)
        {
            DateTime dt;
            if (DateTime.TryParse(lineText.Substring(startLineOffset, keywordLength), out dt))
            {
                TagDateTime = dt;
            }
            else TagDateTime = null;
        }

        public DateTime? TagDateTime { get; set; }
    }
}
